Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop ppx deriving #50

Merged
merged 3 commits into from
Oct 17, 2020
Merged

Conversation

ulrikstrid
Copy link
Contributor

@ulrikstrid ulrikstrid commented Oct 12, 2020

Fixes #49

This is the code that the ppx generates:

let rec equal : t -> t -> Ppx_deriving_runtime.bool =
  let __0 () = equal in
  ((let open! ((Ppx_deriving_runtime)[@ocaml.warning "-A"]) in
      fun lhs ->
        fun rhs ->
          match (lhs, rhs) with
          | (L lhs0, L rhs0) ->
              ((fun (a : string) -> fun b -> a = b)) lhs0 rhs0
          | (Q lhs0, Q rhs0) ->
              ((fun (a : string) -> fun b -> a = b)) lhs0 rhs0
          | (P lhs0, P rhs0) -> ((fun (a : int) -> fun b -> a = b)) lhs0 rhs0
          | (S lhs0, S rhs0) ->
              (let rec loop x y =
                 match (x, y) with
                 | ([], []) -> true
                 | (a::x, b::y) -> ((fun x -> (__0 ()) x) a b) && (loop x y)
                 | _ -> false in
               (fun x -> fun y -> loop x y)) lhs0 rhs0
          | _ -> false)
    [@ocaml.warning "-A"])[@@ocaml.warning "-39"]

@paurkedal
Copy link
Owner

paurkedal commented Oct 16, 2020

It looks good, but I would prefer if list equality is moved to Caqti_common_priv.List as val equal : ('a -> 'a -> bool) -> 'a list -> 'a list -> bool.

@paurkedal
Copy link
Owner

I move out List.equal and will merge when the CI succeeds. Thanks!

@paurkedal paurkedal merged commit 983705c into paurkedal:master Oct 17, 2020
@ulrikstrid ulrikstrid deleted the drop-ppx_deriving branch October 17, 2020 17:41
@ulrikstrid
Copy link
Contributor Author

I didn't have time to finish it until today so thank you for fixing it for me 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Drop ppx_deriving
2 participants